﻿using B.S.BaseData.Api.Read.Command.HospitalCommand;
using B.S.BaseData.ErrorCode;
using B.S.BaseData.Infrastructure.Interface;
using B.S.BataBase.Domain.AI;
using MediatR;

namespace B.S.BaseData.Api.Read.CommandHandler.HospitalCommandHandler
{
    public class DockorShowCommandHandler : IRequestHandler<DockorShowCommand, APIResult<List<DoctorModel>>>
    {
        private readonly IBaseRepository<DoctorModel> _baseRepository;
        public DockorShowCommandHandler(IBaseRepository<DoctorModel> baseRepository)
        {
            _baseRepository = baseRepository;
        }
        public Task<APIResult<List<DoctorModel>>> Handle(DockorShowCommand request, CancellationToken cancellationToken)
        {
            APIResult<List<DoctorModel>> result = new APIResult<List<DoctorModel>>();
            var list = _baseRepository.GetAll();
            result.Data = list.ToList();
            result.Code = ApiEnum.Success;
            result.Msg = "就诊医生信息显示成功";
            return Task.FromResult(result);
        }
    }
}
